package com.yanqu.road.server.cmd.activity.cross;

import com.yanqu.road.entity.activity.ActivityConditionInfo;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.harps.HarpsConfigSync;
import com.yanqu.road.entity.activity.jiuzhou.JiuZhouUserBaseData;
import com.yanqu.road.entity.activity.jiuzhou.config.JiuZhouConfig;
import com.yanqu.road.entity.activity.mall.MallActivityInfo;
import com.yanqu.road.entity.activity.ppl.PplUserData;
import com.yanqu.road.entity.activity.suitang.config.SuiTangConfigSync;
import com.yanqu.road.entity.activity.tonbing.config.TonBingConfig;
import com.yanqu.road.entity.activity.tonbingchannel.config.ChannelTonBingConfig;
import com.yanqu.road.entity.activity.tongbing.config.TongBingConfig;
import com.yanqu.road.entity.autodata.wealthscroll.WealthScrollUserData;
import com.yanqu.road.entity.config.goods.BuyGoodsResult;
import com.yanqu.road.entity.config.goods.MallInfo;
import com.yanqu.road.entity.config.goods.MallWheelResult;
import com.yanqu.road.entity.enums.activity.eActivityChargeType;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.entity.enums.eGoodsType;
import com.yanqu.road.entity.enums.eMallCategory;
import com.yanqu.road.entity.enums.eShopType;
import com.yanqu.road.entity.player.UserPageantData;
import com.yanqu.road.entity.servercenter.ServerInfo;
import com.yanqu.road.logic.activity.chuhan.ChuHanConfig;
import com.yanqu.road.logic.config.GameConfig;
import com.yanqu.road.pb.mall.MallProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.ActivityMallModule;
import com.yanqu.road.server.gameplayer.module.activity.game2048.PageantModule;
import com.yanqu.road.server.gameplayer.module.activity.jiuzhou.JiuZhouModule;
import com.yanqu.road.server.gameplayer.module.activity.oldplayerreturn.OldPlayerReturnModule;
import com.yanqu.road.server.gameplayer.module.activity.ppl.PplModule;
import com.yanqu.road.server.gameplayer.module.activity.suitang.SuiTangModule;
import com.yanqu.road.server.gameplayer.module.activity.travelbook.TravelBookModule;
import com.yanqu.road.server.gameplayer.module.player.PlayerModule;
import com.yanqu.road.server.gameplayer.module.player.WealthScrollModule;
import com.yanqu.road.server.manger.ServerListMgr;
import com.yanqu.road.server.manger.VipMgr;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.MallActivityMgr;
import com.yanqu.road.server.manger.activity.NormalActivityMgr;
import com.yanqu.road.server.manger.activity.RelationActivityMgr;
import com.yanqu.road.server.manger.activity.able.ActivityAbleMgr;
import com.yanqu.road.server.manger.activity.chefduel.ChefDuelMgr;
import com.yanqu.road.server.manger.activity.cookboy.CookBoyMgr;
import com.yanqu.road.server.manger.activity.drawPictures.DrawPicturesActivityMgr;
import com.yanqu.road.server.manger.activity.harps.HarpsMgr;
import com.yanqu.road.server.manger.activity.jiuzhou.JiuZhouMgr;
import com.yanqu.road.server.manger.activity.suitang.SuiTangMgr;
import com.yanqu.road.server.manger.activity.tonbing.TonBingMgr;
import com.yanqu.road.server.manger.activity.oldplayerreturn.OldPlayerReturnMgr;
import com.yanqu.road.server.manger.activity.tonbingchannel.ChannelTonBingMgr;
import com.yanqu.road.server.manger.activity.tongbing.ChuHanMgr;
import com.yanqu.road.server.manger.activity.tongbing.TongBingMgr;
import com.yanqu.road.server.manger.activity.rankunionwar.RankUnionWarMgr;
import com.yanqu.road.server.manger.activity.unionwar.UnionWarActivityMgr;
import com.yanqu.road.server.manger.activity.zhenhuan.ZhenHuanMgr;
import com.yanqu.road.server.manger.config.GoodsMgr;
import com.yanqu.road.server.manger.config.MallMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.manger.config.MallRechargeConfigMgr;
import com.yanqu.road.server.manger.config.SystemOpenMgr;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.util.List;

@Cmd(code = Protocol.S_CROSS_ACTIVITY_BUY_GOODS, desc = "跨服争霸购买道具")
public class CrossActivityBuyGoodsCmd extends AbstractCommand {

    private int mallId;
    private int count;
    private int activityId;

    private BuyGoodsResult result;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        MallProto.BuyGoodsReqMsg reqMsg = MallProto.BuyGoodsReqMsg.parseFrom(packet.getBytes());
        mallId = reqMsg.getMallId();
        count = reqMsg.getCount();
        activityId = reqMsg.getActivityId();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        if (count < 1 || count > GameConfig.MALL_BUY_MAX_COUNT) {
            ret = GameErrorCode.E_MALL_COUNT_NOT_ZERO;
            return;
        }
        ActivityInfo activityInfo = NormalActivityMgr.getActivityInfo(activityId);
        if(activityInfo == null){
            activityInfo = UnionWarActivityMgr.getOpenActivityInfoMap().get(activityId);
        }
        //小当家
        if(activityInfo == null){
            activityInfo = RelationActivityMgr.getOpenActivityInfoMap(eActivityType.CookingBoyActivity.getValue()).get(activityId);
        }
        //厨神对决
        if (activityInfo == null){
            activityInfo = RelationActivityMgr.getOpenActivityInfoMap(eActivityType.ChefDuel.getValue()).get(activityId);
        }

        if(null == activityInfo){
            ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
            return;
        }
        MallInfo mallInfo;
        if (activityInfo.getType() == eActivityType.PatronsSkinCombActivity.getValue()) {//门客组合皮肤配置就在游戏配置
            mallInfo = MallMgr.getMallInfoByMallId(mallId);
            if (null == mallInfo) {
                ret = GameErrorCode.E_MALL_NO_EXIST;
                return;
            }
            int vipLevel = VipMgr.getVipLv(player.getModule(PlayerModule.class).getUserInfo().getVipExp());
            if (vipLevel < mallInfo.getVipLimit()) {
                ret = GameErrorCode.E_MALL_LIMIT_BUY_VIP;
                return;
            }
            //系统解锁限制
            if (mallInfo.getSystemLimit().size() > 0) {
                for (Integer systemId : mallInfo.getSystemLimit()) {
                    if (!SystemOpenMgr.systemOpen(player, systemId)) {
                        ret = GameErrorCode.E_SYSTEM_NO_OPEN;
                        return;
                    }
                }
            }
            List<ActivityConditionInfo> activityConditionInfoList = NormalActivityMgr.getActivityConditionInfoList(activityId);
            if (null == activityConditionInfoList || activityConditionInfoList.size() <= 0) {
                ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                return;
            }
            //对应活动购买对应皮肤
            boolean isFind = false;
            for (ActivityConditionInfo activityConditionInfo : activityConditionInfoList) {
                int param2 = activityConditionInfo.getParamList().get(1).intValue();
                if (param2 == mallInfo.getShopType()) {
                    isFind = true;
                    break;
                }
            }
            if (!isFind) {
                ret = GameErrorCode.E_MALL_BUY_SHOP_TYPE_ERROR;
                return;
            }
        } else {
            mallInfo = NormalActivityMgr.getActivityMallInfo(activityId, mallId);
            if(mallInfo == null){
                mallInfo = UnionWarActivityMgr.getActivityMallInfo(activityId, mallId);
            }
            if(mallInfo == null){
                mallInfo = RelationActivityMgr.getMallInfo(activityId, mallId);
            }
            if (null == mallInfo) {
                ret = GameErrorCode.E_MALL_NO_EXIST;
                return;
            }
            int vipLevel = VipMgr.getVipLv(player.getModule(PlayerModule.class).getUserInfo().getVipExp());
            if (vipLevel < mallInfo.getVipLimit()) {
                ret = GameErrorCode.E_MALL_LIMIT_BUY_VIP;
                return;
            }
            //系统解锁限制
            if (mallInfo.getSystemLimit().size() > 0) {
                for (Integer systemId : mallInfo.getSystemLimit()) {
                    if (!SystemOpenMgr.systemOpen(player, systemId)) {
                        ret = GameErrorCode.E_SYSTEM_NO_OPEN;
                        return;
                    }
                }
            }

            //促织礼包限购
            if(activityInfo.getType() == eActivityType.CricketMallActivity.getValue()){
                if(mallInfo.getReSetTime() > 0 && !"0".equals(mallInfo.getExtendParam())) {
                    ServerInfo serverInfo = ServerListMgr.getServerInfo(GameServer.getInstance().getServerId());
                    MallWheelResult wheelResult = MallActivityMgr.calWheel(activityInfo, serverInfo);
                    MallActivityInfo mallActivityInfo = MallActivityMgr.getInTimeActivity(activityId);
                    if (mallActivityInfo == null) {
                        ret = GameErrorCode.E_MALL_NO_EXIST;
                        return;
                    }
                    int allRound = MallActivityMgr.getAllRound(mallInfo.getReSetTime(), mallActivityInfo.getMallInfoMap().values());
                    int round = Integer.parseInt(mallInfo.getExtendParam());
                    if (round != wheelResult.calRound(allRound, mallInfo.getReSetTime())) {
                        log.info("CricketMallActivity activity {} user {} buy mallId {} limit", activityId, player.getUserId(), mallId);
                        ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                        return;
                    }
                }
            }

            if (mallInfo.getShopType() == eShopType.ZhenHuanSecondProcessIngotsShop.getValue() || mallInfo.getShopType() == eShopType.ZhenHuanThirdProcessIngotsShop.getValue()) {
                //二 三阶段元宝礼包需要有资格才能买
                if (!ZhenHuanMgr.isActivityAble(player.getUserId(), mallInfo.getActivityId())) {
                    ret = GameErrorCode.E_ZHENHUAN_SECOND_PROCESS_NOT_ABLE;
                    return;
                }
                if (!ActivityMgr.activityInTime(activityInfo)) {
                    ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                    return;
                }
            }

            if (mallInfo.getShopType() != eShopType.CrossRankActivityIngotMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CrossRankActivityExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.MysteriousMerchantMall.getValue() &&
                    mallInfo.getShopType() != eShopType.HuaShiGangExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CrossHolidayActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.PageantActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ThrowingPotMall.getValue() &&
                    mallInfo.getShopType() != eShopType.TreasureMall.getValue() &&
                    mallInfo.getShopType() != eShopType.YearMasterMall.getValue() &&
                    mallInfo.getShopType() != eShopType.PplMall.getValue() &&
                    mallInfo.getShopType() != eShopType.JianChuangHuaMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DrawPicturesMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DaFuWengMall.getValue() &&
                    mallInfo.getShopType() != eShopType.UnionWarActivityIngotMall.getValue() &&
                    mallInfo.getShopType() != eShopType.UnionWarActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.TangHuLuMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ShuiHuMall.getValue() &&
                    mallInfo.getShopType() != eShopType.BowArtActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.BowArtActivityBuyMall.getValue() &&
                    mallInfo.getShopType() != eShopType.GhostMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SuoYaoMall.getValue() &&
                    mallInfo.getShopType() != eShopType.BusyFarmingMall.getValue() &&
                    mallInfo.getShopType() != eShopType.HuaShiGangBattleExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.HangHaiMall.getValue() &&
                    mallInfo.getShopType() != eShopType.PawnshopMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DragonBoatRaceActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DrinkActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.XiaYueMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DunHuangShiKuMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CookBoy1ActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CookBoy2ActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CookBoy3ActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CookBoy3ActivityIngotsMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CookBoy2ActivityIngotsMall.getValue() &&

                    mallInfo.getShopType() != eShopType.ChefDuelPhase2ScoreShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ChefDuelPhase3ScoreMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ChefDuelPhase2IngotShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ChefDuelPhase3IngotMall.getValue() &&

                    mallInfo.getShopType() != eShopType.CelebrationActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CelebrationActivityBuyMall.getValue() &&
                    mallInfo.getShopType() != eShopType.LanRuoSiActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.GuiChuiDengActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.GourdChildActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.GourdPlantActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.YingXinActivityMall.getValue() &&
                    mallInfo.getShopType() !=eShopType.WinterLoveActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.HellActivityMall.getValue()&&
                    mallInfo.getShopType() != eShopType.XiaowuRecallActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DouLuoDaLuActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ShrekActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ShrekActivityMall2.getValue() &&
                    mallInfo.getShopType() != eShopType.XiaoyuCostumeActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ChannelRankActivityIngotMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ChannelRankActivityExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ShuiHuYeZiCardMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SpringDinnerActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SeacraftActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ToyHouseExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ShuShanActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.TongBingFoodMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ChuHanFoodMall.getValue() &&
                    mallInfo.getShopType() != eShopType.TonBingFoodMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ZhouNianTurntableMall.getValue() &&
                    mallInfo.getShopType() != eShopType.BusinessReunionActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.TongBingYuanBaoMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ChuHanYuanBaoMall.getValue() &&
                    mallInfo.getShopType() != eShopType.TonBingYuanBaoMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ClimbTowerActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.OperaMaskExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.RankUnionWarMall.getValue() &&
                    mallInfo.getShopType() != eShopType.RankUnionWarYuanBaoMall.getValue() &&
                    mallInfo.getShopType() != eShopType.RankUnionWarRmbMall.getValue() &&
                    mallInfo.getShopType() != eShopType.FellingTreesExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.TwinsExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.WasheExpressionMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CatActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.WorldCupActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CricketNormalMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CricketAdvanceMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CarpTripExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.FireWork2023NormalMall.getValue() &&
                    mallInfo.getShopType() != eShopType.XiuXianMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ShanHeFeastMall.getValue() &&
                    mallInfo.getShopType() != eShopType.JieShi.getValue() &&
                    mallInfo.getShopType() != eShopType.FanXiuSpringMall.getValue() &&
                    mallInfo.getShopType() != eShopType.PeerlessBeautyLotteryMall.getValue() &&
                    mallInfo.getShopType() != eShopType.BianLiangActivePlayerMall.getValue() &&
                    mallInfo.getShopType() != eShopType.OldPlayerReturnPlayerMall.getValue() &&
                    mallInfo.getShopType() != eShopType.GoddessActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.LangYaMemorialMall.getValue() &&
                    mallInfo.getShopType() != eShopType.CommonWishActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DeepFishingActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SilkRoadScoreMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DeepFishingActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.LangYaBangScoreMall.getValue() &&
                    mallInfo.getShopType() != eShopType.WaSheExchangeActivityMall.getValue() &&
                    mallInfo.getShopType() != eShopType.WaSheIngotMall.getValue() &&
                    mallInfo.getShopType() != eShopType.WaSheRefresh.getValue() &&
                    mallInfo.getShopType() != eShopType.WaSheDirectPurchaseRmbMall.getValue() &&
                    mallInfo.getShopType() != eShopType.AdvertisementFreeNoWatchMall.getValue() &&
                    mallInfo.getShopType() != eShopType.WanYaoMall.getValue() &&
                    mallInfo.getShopType() != eShopType.QixiMall.getValue() &&
                    mallInfo.getShopType() != eShopType.BaiFuJuZhenYuanBaoMall.getValue() &&
                    mallInfo.getShopType() != eShopType.GuaGiftsMall.getValue() &&
                    mallInfo.getShopType() != eShopType.GoldAutumnMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DigGoldMall.getValue() &&
                    mallInfo.getShopType() != eShopType.TenDaysDiscountFreeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.DaoMuMall.getValue() &&
                    mallInfo.getShopType() != eShopType.WitchDrawMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SteleSoulGiftsMall.getValue() &&
                    mallInfo.getShopType() != eShopType.JiuZhouMall.getValue() &&
                    mallInfo.getShopType() != eShopType.JiuZhouIngotMall.getValue() &&
                    mallInfo.getShopType() != eShopType.JiuZhouRmbMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SnowGardenMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SnowGardenSecondMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SnowGardenGiftMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SnowGardenSecondGiftMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SnowGardenServerBuyMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SnowGardenServerSecondBuyMall.getValue() &&
                    mallInfo.getShopType() != eShopType.RuiShouMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ZhenHuanFirstProcessShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ZhenHuanSecondProcessShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ZhenHuanThirdProcessShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ZhenHuanThirdProcessIngotsShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ZhenHuanSecondProcessIngotsShop.getValue() &&
                    mallInfo.getShopType() != eShopType.SpringDrawMall.getValue() &&
                    mallInfo.getShopType() != eShopType.HongXianShop.getValue() &&
                    mallInfo.getShopType() != eShopType.XingYouShanShuiShop.getValue() &&
                    mallInfo.getShopType() != eShopType.XingYouShanShuiRmbMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SummerGamesShop.getValue() &&
                    mallInfo.getShopType() != eShopType.SummerGamesAllBuy.getValue() &&
                    mallInfo.getShopType() != eShopType.SummerQuizShop.getValue() &&
                    mallInfo.getShopType() != eShopType.StelsSoulShop.getValue() &&
                    mallInfo.getShopType() != eShopType.SuiTangJunZiMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SuiTangTeHuiYBMall.getValue() &&
                    mallInfo.getShopType() != eShopType.BusinessDepartExchangeMall.getValue() &&
                    mallInfo.getShopType() != eShopType.BusinessDepartGiftMall.getValue() &&
                    mallInfo.getShopType() != eShopType.FoxCardShop.getValue() &&
                    mallInfo.getShopType() != eShopType.HarpsMall.getValue() &&
                    mallInfo.getShopType() != eShopType.SonHaiGift.getValue() &&
                    mallInfo.getShopType() != eShopType.TurtleShop.getValue() &&
                    mallInfo.getShopType() != eShopType.StarLightShop.getValue() &&
                    mallInfo.getShopType() != eShopType.IceServerGiftRmbMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ApprenticeIngotShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ApprenticeAllBuy.getValue()&&
                    mallInfo.getShopType() != eShopType.WealthScrollMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ChefDuelPhase1ScoreShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ChefDuelPhase2ScoreShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ChefDuelPhase2IngotShop.getValue() &&
                    mallInfo.getShopType() != eShopType.ChefDuelPhase3IngotMall.getValue() &&
                    mallInfo.getShopType() != eShopType.ChefDuelPhase3ScoreMall.getValue() &&
                    mallInfo.getShopType() != eShopType.YQHotelShop.getValue()
            ) {
                ret = GameErrorCode.E_MALL_BUY_SHOP_TYPE_ERROR;
                return;
            }
        }

        if (activityInfo.getType() == eActivityType.CrossHolidayActivity.getValue() ||
                activityInfo.getType() == eActivityType.CrossHuaShiGangActivity.getValue() ||
                activityInfo.getType() == eActivityType.PageantActivity.getValue() ||
                activityInfo.getType() == eActivityType.ThrowingPotActivity.getValue() ||
                activityInfo.getType() == eActivityType.PatronsSkinCombActivity.getValue() ||
                activityInfo.getType() == eActivityType.YearMasterActivity.getValue() ||
                activityInfo.getType() == eActivityType.TreasureActivity.getValue() ||
                activityInfo.getType() == eActivityType.PplActivity.getValue() ||
                activityInfo.getType() == eActivityType.JianChuangHuaActivity.getValue() ||
                activityInfo.getType() == eActivityType.DrawPicturesActivity.getValue() ||
                activityInfo.getType() == eActivityType.DaFuWeng.getValue()  ||
                activityInfo.getType() == eActivityType.CrossUnionWarActivity.getValue() ||
                activityInfo.getType() == eActivityType.TangHuluActivity.getValue() ||
                activityInfo.getType() == eActivityType.ShuiHuActivity.getValue() ||
                activityInfo.getType() == eActivityType.BowArtActivity.getValue() ||
                activityInfo.getType() == eActivityType.GhostActivity.getValue() ||
                activityInfo.getType() == eActivityType.SuoYaoActivity.getValue() ||
                activityInfo.getType() == eActivityType.BusyFarmingActivity.getValue() ||
                activityInfo.getType() == eActivityType.HangHaiActivity.getValue() ||
                activityInfo.getType() == eActivityType.PawnshopActivity.getValue() ||
                activityInfo.getType() == eActivityType.DragonBoatRaceActivity.getValue() ||
                activityInfo.getType() == eActivityType.DrinkActivity.getValue() ||
                activityInfo.getType() == eActivityType.XiaYueActivity.getValue()||
                activityInfo.getType() == eActivityType.CrossDunHuangShiKuActivity.getValue()||
                activityInfo.getType() == eActivityType.CookingBoyActivity.getValue() ||
                activityInfo.getType() == eActivityType.ChefDuel.getValue() ||
                activityInfo.getType() == eActivityType.CelebrationActivity.getValue() ||
                activityInfo.getType() == eActivityType.LanRuoSiActivity.getValue() ||
                activityInfo.getType() == eActivityType.GourdChildActivity.getValue() ||
                activityInfo.getType() == eActivityType.WinterLoveActivity.getValue() ||
                activityInfo.getType() == eActivityType.YingXinActivity.getValue()||
                activityInfo.getType() == eActivityType.HellActivity.getValue()||
                activityInfo.getType() == eActivityType.XiaowuRecallActivity.getValue() ||
                activityInfo.getType() == eActivityType.DouLuoDaLuActivity.getValue() ||
                activityInfo.getType() == eActivityType.DouLuoShrekActivity.getValue() ||
                activityInfo.getType() == eActivityType.XiaoyuCostumeActivity.getValue()||
                activityInfo.getType() == eActivityType.ChannelRankActivity.getValue()||
                activityInfo.getType() == eActivityType.SpringDinner.getValue() ||
                activityInfo.getType() == eActivityType.ShuiHuYeZiCardActivity.getValue() ||
                activityInfo.getType() == eActivityType.SeacraftActivity.getValue() ||
                activityInfo.getType() == eActivityType.ToyHouse.getValue() ||
                activityInfo.getType() == eActivityType.ChineseChess.getValue() ||
                activityInfo.getType() == eActivityType.ShuShanActivity.getValue() ||
                activityInfo.getType() == eActivityType.TongBingActivity.getValue() ||
                activityInfo.getType() == eActivityType.ChuHanZB.getValue() ||
                activityInfo.getType() == eActivityType.TonBingActivity.getValue() ||
                activityInfo.getType() == eActivityType.ChannelTonBingActivity.getValue() ||
                activityInfo.getType() == eActivityType.ZhouNianTurntable.getValue() ||
                activityInfo.getType() == eActivityType.ClimbTower.getValue() ||
                activityInfo.getType() == eActivityType.OperaMask.getValue() ||
                activityInfo.getType() == eActivityType.RankUnionWar.getValue() ||
                activityInfo.getType() == eActivityType.FellingTrees.getValue() ||
                activityInfo.getType() == eActivityType.Pasture.getValue() ||
                activityInfo.getType() == eActivityType.Cat.getValue() ||
                activityInfo.getType() == eActivityType.WorldCup.getValue() ||
                activityInfo.getType() == eActivityType.CricketSeasonActivity.getValue() ||
                activityInfo.getType() == eActivityType.CarpTripActivity.getValue() ||
                activityInfo.getType() == eActivityType.FireWork2023.getValue() ||
                activityInfo.getType() == eActivityType.XiuXian.getValue() ||
                activityInfo.getType() == eActivityType.Feast.getValue() ||
                activityInfo.getType() == eActivityType.JieShi.getValue() ||
                activityInfo.getType() == eActivityType.LangYaMemorial.getValue() ||
                activityInfo.getType() == eActivityType.FanXiuSpringActivity.getValue() ||
                activityInfo.getType() == eActivityType.CommonWishDraw.getValue() ||
                activityInfo.getType() == eActivityType.PeakSeacraftActivity.getValue() ||
                activityInfo.getType() == eActivityType.RecallPlayerActivity.getValue() ||
                activityInfo.getType() == eActivityType.OldPlayerReturn.getValue() ||
                activityInfo.getType() == eActivityType.GoddessActivity.getValue() ||
                activityInfo.getType() == eActivityType.LangYaBang.getValue() ||
                activityInfo.getType() == eActivityType.PeerlessBeautyLotteryActivity.getValue() ||
                activityInfo.getType() == eActivityType.DeepFishing.getValue() ||
                activityInfo.getType() == eActivityType.WanYao.getValue() ||
                activityInfo.getType() == eActivityType.QiXiActivity.getValue() ||
                activityInfo.getType() == eActivityType.GuaGiftsActivity.getValue() ||
                activityInfo.getType() == eActivityType.GoldAutumn.getValue() ||
                activityInfo.getType() == eActivityType.DigGold.getValue() ||
                (activityInfo.getType() == eActivityType.RechargeActivity.getValue() && activityInfo.getChildType() == eActivityChargeType.TenDayDiscountRecharge.getChildType()) ||
                activityInfo.getType() == eActivityType.DaoMu.getValue() ||
                activityInfo.getType() == eActivityType.WitchDraw.getValue() ||
                activityInfo.getType() == eActivityType.JiuZhou.getValue() ||
                activityInfo.getType() == eActivityType.SnowGarden.getValue() ||
                activityInfo.getType() == eActivityType.ActivityFund.getValue() ||
                activityInfo.getType() == eActivityType.RuiShou.getValue() ||
                activityInfo.getType() == eActivityType.ZhenHuan.getValue() ||
                activityInfo.getType() == eActivityType.SpringDraw.getValue() ||
                activityInfo.getType() == eActivityType.HongXianActivity.getValue() ||
                activityInfo.getType() == eActivityType.XingYouShanShui.getValue() ||
                mallInfo.getShopType() == eShopType.StelsSoulShop.getValue() ||
                activityInfo.getType() == eActivityType.SuiTang.getValue() ||
                activityInfo.getType() == eActivityType.BusinessDepart.getValue() ||
                activityInfo.getType() == eActivityType.FoxCard.getValue() ||
                activityInfo.getType() == eActivityType.SummerGames.getValue() ||
                activityInfo.getType() == eActivityType.SummerQuiz.getValue() ||
                activityInfo.getType() == eActivityType.Harps.getValue() ||
                activityInfo.getType() == eActivityType.SonHai.getValue() ||
                activityInfo.getType() == eActivityType.HsIsland.getValue() ||
                activityInfo.getType() == eActivityType.Turtle.getValue() ||
                activityInfo.getType() == eActivityType.Apprentice.getValue() ||
                activityInfo.getType() == eActivityType.YQHotel.getValue() ||
                activityInfo.getType() == eActivityType.ChannelMusicRoomRank.getValue()
        ){
            if(activityInfo.getType() == eActivityType.CookingBoyActivity.getValue()){
                //小当家活动必须晋级的玩家才能买
                if("1".equals(mallInfo.getCanBuyParam())){
                    if(!CookBoyMgr.isUserCookBoyAble(activityId,player.getUserId())){
                        ret = GameErrorCode.E_COOK_BOY_MALL_USER_UNABLE;
                        return;
                    }
                    if(mallInfo.getShopType() == eShopType.CookBoy3ActivityIngotsMall.getValue() ||
                            mallInfo.getShopType() == eShopType.CookBoy2ActivityIngotsMall.getValue()){
                        if (!ActivityMgr.activityInTime(activityInfo)) {
                            ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                            return;
                        }
                    }
                }
            }

            if(activityInfo.getType() == eActivityType.ChefDuel.getValue()){
                //厨神对决活动必须晋级的玩家才能买
                if("1".equals(mallInfo.getCanBuyParam())){
                    if(!ChefDuelMgr.isUserChefDuelAble(activityId,player.getUserId())){
                        ret = GameErrorCode.E_CHEF_DUEL_MALL_USER_UNABLE;
                        return;
                    }
                    if(mallInfo.getShopType() == eShopType.ChefDuelPhase2IngotShop.getValue() ||
                            mallInfo.getShopType() == eShopType.ChefDuelPhase3IngotMall.getValue()){
                        if (!ActivityMgr.activityInTime(activityInfo)) {
                            ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                            return;
                        }
                    }
                }
            }

            if (activityInfo.getType() == eActivityType.Harps.getValue()) {
                boolean stageBeginTimeLimit = true;
                HarpsConfigSync config = HarpsMgr.getConfig();
                if (config != null) {
                    try {
                        if (ActivityMgr.activityInShowTime(config.getActivityInfo())) {
                            stageBeginTimeLimit = false;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (stageBeginTimeLimit) {
                    ret = GameErrorCode.E_ACTIVITY_PREPARE_CAN_NOT_BUY;
                    return;
                }
            }

            if (activityInfo.getType() == eActivityType.SuiTang.getValue()) {
                boolean stageBeginTimeLimit = true;
                SuiTangConfigSync config = SuiTangMgr.getConfig();
                if (config != null) {
                    try {
                        long stage1BeginTime = config.getStage1TimeList().get(0).get(0);
                        long zeroTimeStamp = DateHelper.getZeroTimeStamp(stage1BeginTime) + 10 * DateHelper.MINUTE_MILLIONS;
                        if (System.currentTimeMillis() >= zeroTimeStamp && player.getModule(SuiTangModule.class).hasCamp()) {
                            stageBeginTimeLimit = false;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (stageBeginTimeLimit) {
                    ret = GameErrorCode.E_ACTIVITY_PREPARE_CAN_NOT_BUY;
                    return;
                }
            }
            if (activityInfo.getType() == eActivityType.TongBingActivity.getValue()) {
                boolean stageBeginTimeLimit = true;
                TongBingConfig config = TongBingMgr.getConfig();
                if (config != null) {
                    try {
                        long stage1BeginTime = config.getStage1TimeList().get(0).get(0);
                        long zeroTimeStamp = DateHelper.getZeroTimeStamp(stage1BeginTime);
                        if (System.currentTimeMillis() >= zeroTimeStamp) {
                            stageBeginTimeLimit = false;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (stageBeginTimeLimit) {
                    ret = GameErrorCode.E_ACTIVITY_PREPARE_CAN_NOT_BUY;
                    return;
                }
            }
            if (activityInfo.getType() == eActivityType.ChuHanZB.getValue()) {
                boolean stageBeginTimeLimit = true;
                ChuHanConfig config = ChuHanMgr.getConfig();
                if (config != null) {
                    try {
                        long stage1BeginTime = config.getStage1TimeList().get(0).get(0);
                        long zeroTimeStamp = DateHelper.getZeroTimeStamp(stage1BeginTime);
                        if (System.currentTimeMillis() >= zeroTimeStamp) {
                            stageBeginTimeLimit = false;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (stageBeginTimeLimit) {
                    ret = GameErrorCode.E_ACTIVITY_PREPARE_CAN_NOT_BUY;
                    return;
                }
            }
            if (activityInfo.getType() == eActivityType.TonBingActivity.getValue()) {
                boolean stageBeginTimeLimit = true;
                TonBingConfig config = TonBingMgr.getConfig();
                if (config != null) {
                    try {
                        long stage1BeginTime = config.getStage1TimeList().get(0).get(0);
                        long zeroTimeStamp = DateHelper.getZeroTimeStamp(stage1BeginTime);
                        if (System.currentTimeMillis() >= zeroTimeStamp) {
                            stageBeginTimeLimit = false;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (stageBeginTimeLimit) {
                    ret = GameErrorCode.E_ACTIVITY_PREPARE_CAN_NOT_BUY;
                    return;
                }
            }
            if (activityInfo.getType() == eActivityType.ChannelTonBingActivity.getValue()) {
                boolean stageBeginTimeLimit = true;
                ChannelTonBingConfig config = ChannelTonBingMgr.getConfig();
                if (config != null) {
                    try {
                        long stage1BeginTime = config.getStage1TimeList().get(0).get(0);
                        long zeroTimeStamp = DateHelper.getZeroTimeStamp(stage1BeginTime);
                        if (System.currentTimeMillis() >= zeroTimeStamp) {
                            stageBeginTimeLimit = false;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (stageBeginTimeLimit) {
                    ret = GameErrorCode.E_ACTIVITY_PREPARE_CAN_NOT_BUY;
                    return;
                }
            }
            if (activityInfo.getType() == eActivityType.ChannelRankActivity.getValue()) {
                // 跨地区冲榜资格判断
                if ("1".equals(mallInfo.getCanBuyParam())) {
                    if (!ActivityAbleMgr.isAble(player.getUserId(), activityId)) {
                        ret = GameErrorCode.E_MALL_NO_ACTIVITY_ABLE;
                        return;
                    }
                }
                if (mallInfo.getShopType() == eShopType.ChannelRankActivityIngotMall.getValue() && !ActivityMgr.activityBeforeEndTime(activityInfo)) {
                    ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                    return;
                }
                if (mallInfo.getShopType() == eShopType.ChannelRankActivityExchangeMall.getValue() && !ActivityMgr.activityInShowTime(activityInfo)) {
                    ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                    return;
                }
            }
            if (!ActivityMgr.activityInShowTime(activityInfo)) {
                ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                return;
            }
            if (activityInfo.getType() == eActivityType.PageantActivity.getValue()) {
                UserPageantData userPageantData = player.getModule(PageantModule.class).getUserPageantData(activityInfo.getActivityId());
                //获取vip经验
                long addVipExp = MallRechargeConfigMgr.getParamValue(mallInfo);
                if (userPageantData == null || userPageantData.getTodayGetMoney() < addVipExp) {
                    ret = GameErrorCode.E_MALL_LIMIT_BUY;
                    return;
                }
            }

            //活动期间购买（活动关联道具）
            if(mallInfo.getCategory() == eMallCategory.InActivityTime.getValue() || activityInfo.getType() == eActivityType.SummerGames.getValue()){
                if(ActivityMgr.activityInRewardPeriod(activityInfo)){
                    ret = GameErrorCode.E_MALL_LIMIT_BUY_NO_IN_ACTIVITY_TIME;
                    return;
                }
            }

            if (activityInfo.getType() == eActivityType.PplActivity.getValue()) {
                PplUserData userData = player.getModule(PplModule.class).getUserData();
                //获取vip经验
                long addVipExp = MallRechargeConfigMgr.getParamValue(mallInfo);
                if (userData == null || userData.getTodayScore() < addVipExp) {
                    ret = GameErrorCode.E_MALL_LIMIT_BUY;
                    return;
                }
            }

            if (activityInfo.getType() == eActivityType.DrawPicturesActivity.getValue()) {
                Property rewardProp = mallInfo.getRewardProp();
                if (rewardProp != null
                        && rewardProp.getCountByGoodsId(DrawPicturesActivityMgr.getActivityConsumeId(activityInfo)).compareTo(BigInteger.ZERO) > 0
                        && !ActivityMgr.activityInTime(activityInfo)) {
                    ret = GameErrorCode.E_ACTIVITY_TREASURE_END_LIMIT_BUY_GOODS;
                    return;
                }

            }
            if (mallInfo.getShopType() == eShopType.RankUnionWarMall.getValue()) {
                if (!ActivityMgr.activityInShowTime(activityInfo)) {
                    ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                    return;
                }
            }
            if (mallInfo.getShopType() == eShopType.RankUnionWarYuanBaoMall.getValue()) {
                if (!ActivityMgr.activityInShowTime(activityInfo)) {
                    ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                    return;
                }
                if (!RankUnionWarMgr.isUserCanBuyRmb(activityInfo.getActivityId(),player.getUserId())) {
                    ret = GameErrorCode.E_RANKUNIONWAR_USER_CANNOT_PLAY;
                    return;
                }
            }
            if (activityInfo.getType() == eActivityType.OldPlayerReturn.getValue()) {
                if (mallInfo.getShopType() == eShopType.OldPlayerReturnPlayerMall.getValue()) {
                    //回归玩家才能买
                    if (player.getModule(OldPlayerReturnModule.class).checkReturnRoleIsEffective(OldPlayerReturnMgr.getUserData(player.getUserId())) != 0) {
                        ret = GameErrorCode.E_PLAYER_RETURN_NOT_RETURN_ROLE;
                        return;
                    }
                }
            }
            if (activityInfo.getType() == eActivityType.JiuZhou.getValue()) {
                // 判断下九州的资格
                JiuZhouUserBaseData userData = player.getModule(JiuZhouModule.class).getUserData();
                if (userData == null) {
                    ret = GameErrorCode.E_MALL_LIMIT_BUY;
                    return;
                }
                if (mallInfo.getShopType() == eShopType.JiuZhouMall.getValue()) {
                    List<Integer> extendParamList = StringUtils.stringToIntegerList(mallInfo.getExtendParam(), "\\|");
                    // 判断下资格
                    if (extendParamList.get(2) != 0 && userData.getZoneType() != extendParamList.get(2)) {
                        ret = GameErrorCode.E_MALL_LIMIT_BUY;
                        return;
                    }
                    if (extendParamList.get(1) != 0 && userData.getLastRoundId() < extendParamList.get(1)) {
                        ret = GameErrorCode.E_MALL_LIMIT_BUY;
                        return;
                    }
                } else if (mallInfo.getShopType() == eShopType.JiuZhouIngotMall.getValue() || mallInfo.getShopType() == eShopType.JiuZhouRmbMall.getValue()) {
                    // 只有在开战期内可以买
                    JiuZhouConfig config = JiuZhouMgr.getConfig();
                    if (config == null) {
                        ret = GameErrorCode.E_MALL_NO_ACTIVITY_ABLE;
                        return;
                    }
                    List<Integer> jiuZhouTime = config.getJiuZhouTime();
                    // 报名期结束
                    int startSignTime = jiuZhouTime.get(1);

                    long startTimeStamp = JiuZhouMgr.getTimeStampAfterBegin(startSignTime);

                    long now = System.currentTimeMillis();
                    if (now < startTimeStamp){
                        ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                        return;
                    }
                    if (now > activityInfo.getEndTime() * 1000) {
                        ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                        return;
                    }
                    // 判断下有没有资格
                    if (userData.getHasSignUp() != 1 || userData.getZoneType() == 0) {
                        ret = GameErrorCode.E_MALL_NO_ACTIVITY_ABLE;
                        return;
                    }
                }
            }


            //如果新版本财神密卷还没初始化 商店不给买
            if (mallInfo.getShopType() == eShopType.WealthScrollMall.getValue()){
                if (!player.getModule(WealthScrollModule.class).isNewWealthScrollInTime()){
                    ret = GameErrorCode.E_MALL_NO_ACTIVITY_ABLE;
                    return;
                }
                //如果当前期数不给买 那就不给买
                WealthScrollUserData userData = player.getModule(WealthScrollModule.class).getUserData();
                int param = Integer.parseInt(mallInfo.getParam());
                if (param != userData.getNo()){
                    ret = GameErrorCode.E_MALL_NO_ACTIVITY_ABLE;
                    return;
                }
            }

        }else{
            if (mallInfo.getShopType() == eShopType.WaSheRefresh.getValue()){
                if (!mallInfo.isShow()){
                    ret = GameErrorCode.E_MALL_NO_EXIST;
                    return;
                }
            }
            if (mallInfo.getShopType() == eShopType.CrossRankActivityExchangeMall.getValue()) {
                if (!ActivityMgr.activityInShowTime(activityInfo)) {
                    ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                    return;
                }
            }else if (mallInfo.getShopType() == eShopType.TwinsExchangeMall.getValue()) {
                if (!ActivityMgr.activityInShowTime(activityInfo)) {
                    ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                    return;
                }
            }else {
                if (!ActivityMgr.activityInTime(activityInfo)) {
                    ret = GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
                    return;
                }
            }
        }
        if (activityInfo.getType() == eActivityType.MysteriousMerchantActivity.getValue()) {//神秘商人
            int limitVip = Integer.parseInt(mallInfo.getExtendParam());
            if (VipMgr.getVipLv(player.getUserInfo().getVipExp()) < limitVip) {
                ret = GameErrorCode.E_MALL_BUY_VIP_NO_ENOUGH;
                return;
            }
        }
        if(mallInfo.getShopType() == eShopType.CookBoy2ActivityIngotsMall.getValue()
            || mallInfo.getShopType() == eShopType.CookBoy3ActivityIngotsMall.getValue()
        ){
            if(count > 1){
                int vipLv = VipMgr.getVipLv(player.getUserInfo().getVipExp());
                if(vipLv < GameConfig.GIFT_QUICK_BUY_VIP_LIMIT){
                    ret = GameErrorCode.E_MALL_LIMIT_BUY_VIP;
                    return;
                }
            }
        }

        String reward = mallInfo.getReward();
        String[] goods = reward.split(";");
        if (goods.length == 1) { // 购买的奖励内容如果只有一项
            String[] items = goods[0].split("=");
            int goodsId = Integer.parseInt(items[0]);
            // 校验旅行册卡包里的卡牌是否都满级了
            if (GoodsMgr.getGoodsById(goodsId).getType() == eGoodsType.TravelBookOptionalPack.getValue()
                    || GoodsMgr.getGoodsById(Integer.parseInt(items[0])).getType() == eGoodsType.TravelBookRandomPack.getValue()) {
                int maxNum = player.getModule(TravelBookModule.class).getAlbumRestNumGetMaxLevel(goodsId);
                if (maxNum == 0) {
                    ret = GameErrorCode.E_TRAVEL_BOOK_ALL_CARD_CAN_GET_MAX_LEVEL;
                    return;
                }
            }
            // 校验旅行册卡牌是否满级
            if (GoodsMgr.getGoodsById(goodsId).getType() == eGoodsType.TravelCard.getValue()) {
                if (player.getModule(TravelBookModule.class).checkCardGetMaxLevel(goodsId, new Property())) {
                    ret = GameErrorCode.E_TRAVEL_BOOK_CARD_MAX_LEVEL;
                    return;
                }
            }
        }

        result = player.getModule(ActivityMallModule.class).buyGoods(mallInfo, count);
    }

    @Override
    public void sendData(GamePlayer player) {
        MallProto.BuyGoodsRespMsg.Builder respMsg = MallProto.BuyGoodsRespMsg.newBuilder();
        respMsg.setRet(ret);
        if (0 == ret) {
            if (null != result) {
                respMsg.setRet(result.getRet());
                respMsg.setReward(result.getReward());
            }
        }
        player.sendPacket(Protocol.U_CROSS_ACTIVITY_BUY_GOODS, respMsg);
    }
}
